Skip to content

Conversation

pamaury
Copy link
Contributor

@pamaury pamaury commented Oct 3, 2025

WARNING: text below refers to the old version of the PR

While looking at the chip info, I realized that there were several problems. Originally, the issue comes from the fact that we have a single cc_library that contains both the chip_info.h header and the chip_info.c data. This means that any binary using this dependency ends up including the kChipInfo data even if they didn't intend to. Coupled with the fact that several pieces of code directly refer to kChipInfo instead of the linker symbol _chip_info_start means that for example part of the ROM_EXT doesn't actually read from the ROM's chip_info but from a ROM_EXT-embedded chip info!

I decided to fix that by splitting the library into the header (which is what everyone but the ROM should use) and the data. I also eliminated the kChipInfo symbol from the header entirely and replaced all users with _chip_info_start. While doing so, I stumbled on a subtle linker problem which is that since kChipInfo becomes unused, it won't participate in linking (even if the section is marked as NODISARD) unless --whole-archive is used which fortunaltely bazel has a setting for (alwayslink=True).

I also decided to create a new ROM end-to-end test for the chip info to make sure that the data is present there. Maybe it might be worth also create a ROM_EXT end-to-end test to make sure that it uses the ROM chip info and not some other chip info but I leave that to a future PR.

@pamaury pamaury force-pushed the fix_chip_info branch 3 times, most recently from cb4e92a to 30d6790 Compare October 3, 2025 14:51
],
)

opentitan_test(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add an entry to the tesplan?

Without this option, the chip_info symbol might get discarded if
it is not used directly.

Signed-off-by: Amaury Pouly <[email protected]>
@pamaury pamaury force-pushed the fix_chip_info branch 5 times, most recently from ee183a0 to 2e1b8b4 Compare October 15, 2025 15:54
The name chip_info is misleading because the data is embedded in
every binary. So it actually is a build info. The chip_info is
simply then the ROM's build_info.

Signed-off-by: Amaury Pouly <[email protected]>
The chip_info became broken without anyone realizing because it
was untested. This test ensures that at least the chip info is
filled and has the expected version.

Signed-off-by: Amaury Pouly <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants